#include "GameScene.h"

bool GScoreLayer::init()
{
	bool bRet = false;
	do 
	{
		score =0;
		CC_BREAK_IF(! CCLayer::init());
		CCSize size =CCDirector::sharedDirector()->getWinSize();

		//-------------Scre----------
		CCLabelAtlas *scoreLable =CCLabelAtlas::create("0","labelatlas.png", 16, 24, '.');
		scoreLable->setPosition(ccp(20 ,size.height-20));
		scoreLable->setAnchorPoint(ccp(0,1.0f));
		this->addChild(scoreLable,1,1);
		this->schedule( schedule_selector(GScoreLayer::step) );

		bRet = true;
	} while (0);

	return bRet;
}

void GScoreLayer::step(float dt)
{
	CCLabelAtlas* label2 = (CCLabelAtlas*)getChildByTag(1);
	char string[12] = {0};
	sprintf(string, "%d", score);
	label2->setString( string );    
	//CCLog(((int)kStateNone));
	/*CCSprite* timeSprite = (CCSprite*)getChildByTag(2);
	CCDirector *pDirector = CCDirector::sharedDirector();
	float 	tempScalex =(pDirector->getWinSize().width /	( maxTime /pDirector->getAnimationInterval())) / timeSprite->getContentSize().width;

	timeSprite->setScaleX(timeSprite->getScaleX() + tempScalex);*/
}